#ifndef _LIB_CLASS
#define _LIB_CLASS

function Class( params ) {
	var newClass = function() {
		if ( this.construct instanceof Function )
			this.construct( arguments );
	}
	newClass.prototype = params;
	if ( params.Extends instanceof Function ) {
		var key;
		for ( key in params.Extends.prototype ) {
			if ( key === "construct" )
				newClass.prototype.parent = params.Extends.prototype.construct;
			else if ( !newClass.prototype[ key ] )
				newClass.prototype[ key ] = params.Extends.prototype[ key ];
		}
		delete newClass.Extends; delete params.Extends;
	}
	params = key = null;
	return newClass;
}
#endif